﻿#pragma once

#include <qtreewidget.h>
#include <qlist.h>

class ScriptInstruction;
class ScriptRunner;

class TreeWidget_DisplayScriptList : public QTreeWidget
{
  Q_OBJECT

private:
  QTreeWidgetItem* lastHighLightNode = Q_NULLPTR;//记录上一个高亮的item
  QList<QTreeWidgetItem*> itemList;//用于记录每个item，在高亮当前指令时需要用到
public:
  TreeWidget_DisplayScriptList(QWidget *parent = Q_NULLPTR);
  ~TreeWidget_DisplayScriptList();
private:
  void circularDelete(QTreeWidgetItem* parent);
public slots:
  void slot_showCurrentInstruction(int instructionIndex);
  void slot_clearCurrentInstruction();
  void slot_updateScriptList(QList<ScriptInstruction*> scriptList);
};
